<% lineconst = 3 -%>
<% linenum = grouplist.size/lineconst -%>
<% leftnum = grouplist.size%lineconst -%>
<table width="100%">
<% for i in 0...linenum -%>
     <tr height="90px">
     <% for j in 0...lineconst -%>
       <td  align="center" valign="top" width="<%= 100/lineconst %>%">
       <%= render :partial => 'shared/groupThumbImage', :object =>grouplist[i*lineconst+j]%>
       <p><%= link_to "#{grouplist[i*lineconst+j].title}", group_path(grouplist[i*lineconst+j]) %>(<%= grouplist[i*lineconst+j].users.size%>)</p>
       </td>
     <% end -%>
     </tr>
<% end -%>
<% if leftnum > 0 -%>
  <tr height="90px">
  <% for i in 0...leftnum -%>
    <td  align="center" valign="top" width="<%= 100/lineconst %>%">
    <%= render :partial => 'shared/groupThumbImage', :object =>grouplist[linenum*lineconst+i]%>
    <p><%= link_to "#{grouplist[linenum*lineconst+i].title}", group_path(grouplist[linenum*lineconst+i]) %>(<%= grouplist[linenum*lineconst+i].users.size%>)</p>
    </td>
  <% end -%>
  <% for i in 0...(lineconst-leftnum) -%>
    <td  align="center" valign="top" width="<%= 100/lineconst %>%">
    &nbsp;
    </td>
  <% end -%>
  </tr>
<% end -%>
</table>